package com.sx.pipeline.app.base

import android.annotation.SuppressLint
import android.content.pm.ActivityInfo
import android.os.Bundle
import androidx.annotation.LayoutRes
import androidx.databinding.ViewDataBinding
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.SPUtils
import com.sx.mvvmlibs.base.AppBarBaseActivity
import com.sx.mvvmlibs.base.BaseModel
import com.sx.mvvmlibs.base.BaseViewModel
import com.sx.mvvmlibs.databinding.ViewAppBarBinding
import com.sx.pipeline.app.config.SPKey

/**
 * @Author: YY
 * @Date: 2022/3/14
 * @Description: 二次封装 BaseAppBarActivity
 */
abstract class CYBaseAppBarActivity<V : ViewDataBinding, VM : BaseViewModel<out BaseModel>> (
    @LayoutRes layoutId: Int,
    varViewModelId: Int? = null,
) : AppBarBaseActivity<V, VM, ViewAppBarBinding>(layoutId, varViewModelId), IStatus {

    @SuppressLint("SourceLockedOrientationActivity")
    override fun onCreate(savedInstanceState: Bundle?) {
        // 强制设置为竖屏
        requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
        super.onCreate(savedInstanceState)
        // 身份类型初始化
        initIdentity(SPUtils.getInstance().getInt(SPKey.SP_IDENTITY_TYPE, 0))
    }

    override fun initData() {
        ARouter.getInstance().inject(this)
    }
}